﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Pay.TO;
using Newtonsoft.Json;

namespace Pay.DTO {
    /// <summary>
    /// 产品表：mc_Product
    /// </summary>
    [Serializable]
    public class product_dto {
        public product_dto() {
            image_path = new List<string>();
            props = new List<props_cls>();
            product_skus = new List<product_sku_dto>();
            sku_infos = new List<sku_info_dto>();
        }
        /// <summary>
        /// 产品id
        /// </summary>
        public long id { get; set; }
        /// <summary>
        /// 海淘乐商品id
        /// </summary>
        public long products_id { get; set; }
        /// <summary>
        /// 海淘乐商品唯一编码
        /// </summary>
        public string sku { get; set; }
        /// <summary>
        /// 代理价
        /// </summary>
        public string agent_prices { get; set; }
        /// <summary>
        /// 一级类目ID
        /// </summary>
        public long first_categories_id { get; set; }
        /// <summary>
        /// 一级类目名称
        /// </summary>
        public string first_categories_name { get; set; }
        /// <summary>
        /// 二级类目ID
        /// </summary>
        public long second_categories_id { get; set; }
        /// <summary>
        /// 二级类目名称
        /// </summary>
        public string second_categories_name { get; set; }
        /// <summary>
        /// 三级类目ID
        /// </summary>
        public long third_categories_id { get; set; }
        /// <summary>
        /// 三级类目名称
        /// </summary>
        public string third_categories_name { get; set; }
        /// <summary>
        /// 运费ID
        /// </summary>
        public string express_id { get; set; }
        /// <summary>
        /// 仓储费ID
        /// </summary>
        public long store_expenses_id { get; set; }
        /// <summary>
        /// 库存方式
        /// 1 – 保税仓
        /// 2 – 直邮
        /// 3 – 现货
        /// </summary>
        public int store_type { get; set; }
        /// <summary>
        /// 仓库名称
        /// </summary>
        public string store_name { get; set; }
        /// <summary>
        /// 所属海关名称
        /// </summary>
        public string customs_name { get; set; }
        /// <summary>
        /// 产地
        /// </summary>
        public string producing_area { get; set; }
        /// <summary>
        /// 品牌ID
        /// </summary>
        public long brands_id { get; set; }
        /// <summary>
        /// 品牌名称
        /// </summary>
        public string brands_name { get; set; }
        /// <summary>
        /// 规格名称
        /// </summary>
        public string specification { get; set; }
        /// <summary>
        /// 保质期
        /// </summary>
        public string shelf_life { get; set; }
        /// <summary>
        /// 最高购买数量（0表示不限制）
        /// </summary>
        public int max_quantity { get; set; }
        /// <summary>
        /// 单笔订单最低起购量
        /// </summary>
        public int min_quantity { get; set; }
        /// <summary>
        /// 单位数量/次
        /// </summary>
        public int unit_quantity { get; set; }
        /// <summary>
        /// 商品是否可搭配购买（0：否，1：是）
        /// </summary>
        public int is_collection { get; set; }
        /// <summary>
        /// 促销标签
        /// </summary>
        public string tag_name { get; set; }
        /// <summary>
        /// 商品主图
        /// </summary>
        public string main_image_url { get; set; }
        /// <summary>
        /// 操作状态
        /// 1 – 添加，表示没有推送过该商品
        /// 2 – 修改，表示之前已经推送过该商品，但海淘乐系统有更新信息
        /// </summary>
        public int request_status { get; set; }
        /// <summary>
        /// 是否海淘乐商品
        /// </summary>
        public int is_htl { get; set; }
        /// <summary>
        /// 商户id
        /// </summary>
        public virtual long merchant_id { get; set; }
        /// <summary>
        /// 名称
        /// </summary>
        public string name { get; set; }
        /// <summary>
        /// 分销等级
        /// </summary>
        public int? depth { get; set; }
        /// <summary>
        /// 分销比例
        /// </summary>
        public string path { get; set; }
        /// <summary>
        /// 价格分销比例
        /// </summary>
        public decimal? distribution_price { get; set; }
        /// <summary>
        /// 条码
        /// </summary>
        public string code { get; set; }
        /// <summary>
        /// 分类id
        /// </summary>
        public long? category_id { get; set; }
        /// <summary>
        /// 市场价格
        /// </summary>
        public decimal market_price { get; set; }
        /// <summary>
        /// 价格
        /// </summary>
        public decimal price { get; set; }
        /// <summary>
        /// 成本价
        /// </summary>
        public decimal? cost_price { get; set; }
        /// <summary>
        /// 兑换积分
        /// </summary>
        public int integral { get; set; }
        /// <summary>
        /// 库存
        /// </summary>
        public int stock { get; set; }
        /// <summary>
        /// 销售量
        /// </summary>
        public int sale_count { get; set; }
        /// <summary>
        /// 运费
        /// </summary>
        public decimal? freight { get; set; }
        /// <summary>
        /// 第一张图片
        /// </summary>
        /// <value>The first image.</value>
        public string first_image {
            get {
                if (image_path.Count > 0) return image_path.First();
                return string.Empty;
            }
        }
        /// <summary>
        /// 图片JSON:["",""]
        /// </summary>
        public List<string> image_path { get; set; }
        /// <summary>
        /// 发布时间
        /// </summary>
        public DateTime create_time { get; set; }
        /// <summary>
        /// 更新时间
        /// </summary>
        public DateTime update_time { get; set; }
        /// <summary>
        /// 备注说明
        /// </summary>
        public string short_description { get; set; }
        /// <summary>
        /// 内容
        /// </summary>
        public string description { get; set; }
        /// <summary>
        /// 销售状态:0原始状态,1出售中,2仓库中,3已删除
        /// </summary>
        public virtual SaleStatus sale_status { get; set; }
        /// <summary>
        /// 审核状态:1待审核,2销售中,3违规下架
        /// </summary>
        public virtual AuditStatus audit_status { get; set; }
        /// <summary>
        /// 审核原因
        /// </summary>
        public virtual string audit_reason { get; set; }
        /// <summary>
        /// 商品类型 1：实物 2：虚拟，3：积分，4：普惠积分，5：398升级创客商品
        /// </summary>
        public int type { get; set; }
        /// <summary>
        /// 排序
        /// </summary>
        public int top { get; set; }
        /// <summary>
        /// 产品属性
        /// </summary>
        public List<props_cls> props { get; set; }
        /// <summary>
        /// 卖家编号
        /// </summary>
        public string bind_no { get; set; }
        /// <summary>
        /// 商品标签better：精选，hot：爆款
        /// </summary>
        public string tag { get; set; }
        /// <summary>
        /// 商品规格
        /// </summary>
        public List<product_sku_dto> product_skus { get; set; }
        /// <summary>
        /// 产品SKU和值
        /// </summary>
        public List<sku_info_dto> sku_infos { get; set; }
        /// <summary>
        /// 赠送积分
        /// </summary>
        public int points { get; set; }
        /// <summary>
        /// 是否开启三级分销
        /// </summary>
        public bool is_open { get; set; }
        /// <summary>
        /// 国家编码
        /// </summary>
        public string country { get; set; }
        /// <summary>
        /// 是否境外商品
        /// </summary>
        public bool is_seas { get; set; }
        /// <summary>
        /// 净重
        /// </summary>
        public double weight { get; set; }
        /// <summary>
        /// 净重单位
        /// </summary>
        /// <value>The weight unit.</value>
        public string weight_unit { get; set; }
        /// <summary>
        ///  税点
        /// </summary>
        public decimal? tax { get; set; }
        /// <summary>
        /// 计量单位编码
        /// </summary>
        public string unit { get; set; }
        /// <summary>
        /// 是否包税
        /// </summary>
        public bool is_tax { get; set; }
        /// <summary>
        /// 是否包运费
        /// </summary>
        public bool is_freight { get; set; }
        /// <summary>
        ///  商品申报id
        /// </summary>
        public long? good_dec_id { get; set; }
        /// <summary>
        /// 是否app发布
        /// </summary>
        public bool is_app { get; set; }
        /// <summary>
        /// 是否已分销
        /// </summary>
        public bool is_distribution { get; set; }
        /// <summary>
        /// 产品活动扩展
        /// </summary>
        public product_dto_activity_ex activity_ex {get;set;}

        public merchant_dto merchant { get; set; }
        public good_declaration_dto good_declaration { get; set; }
    }
    /// <summary>
    /// 购物车商品
    /// </summary>
    [Serializable]
    public class product_cart_dto {
        /// <summary>
        /// 商品id
        /// </summary>
        public long product_id { get; set; }
        /// <summary>
        /// 商品名称
        /// </summary>
        public string product_name { get; set; }
        /// <summary>
        /// 商品价格
        /// </summary>
        public decimal price { get; set; }
        /// <summary>
        /// 活动价格红钻部分
        /// </summary>
        public decimal activity_red_drill { get; set; }
        /// <summary>
        /// 商品规格
        /// </summary>
        public string product_sku_name { get; set; }
        /// <summary>
        /// 商品数量
        /// </summary>
        public int num { get; set; }
        /// <summary>
        /// 商品库存
        /// </summary>
        public int product_stock { get; set; }
        /// <summary>
        /// 商品主图
        /// </summary>
        public string product_main_img { get; set; }
        /// <summary>
        ///购物车id
        /// </summary>
        public long cart_id { get; set; }
        /// <summary>
        /// skuid
        /// </summary>
        public long sku_id { get; set; }
        /// <summary>
        /// 分享人
        /// </summary>
       public string merchant_no { get; set; }
        ///// <summary>
        ///// 分享店铺id
        ///// </summary>
        //public long distribution_shop_id { get; set; }
    }
    /// <summary>
    /// 产品活动扩展
    /// </summary>
    public class product_dto_activity_ex {
        /// <summary>
        /// 是否参与活动
        /// </summary>
        public bool is_activity { get; set; }
        /// <summary>
        /// 活动类型
        /// </summary>
        public EActivityType activity_type { get; set; }
        /// <summary>
        /// 产品活动Id
        /// </summary>
        public long? product_activity_id { get; set; }
        /// <summary>
        /// 活动价格红钻部分
        /// </summary>
        public decimal activity_red_drill { get; set; }
        /// <summary>
        /// 是否售尽
        /// </summary>
        public bool is_sold_out { get; set; }
        /// <summary>
        /// 活动开始时间
        /// </summary>
        public DateTime begin_time { get; set; }
        /// <summary>
        /// 活动结束时间
        /// </summary>
        public DateTime end_time { get; set; }
        /// <summary>
        /// 开始预热时间
        /// </summary>
        public DateTime? preheat_time { get; set; }
    }

	/// <summary>
	/// 产品属性
	/// </summary>
	[Serializable]
	public class props_cls {
		/// <summary>
		/// 属性名
		/// </summary>
		public string name { get; set; }
		/// <summary>
		/// 属性内容
		/// </summary>
		public string value { get; set; }
	}
    /// <summary>
    /// 店铺商品
    /// </summary>
    public class product_shop_dto {
        public long id { get; set; }
        /// <summary>
        /// 名称
        /// </summary>
        public string name { get; set; }
        /// <summary>
        /// 价格
        /// </summary>
        public decimal price { get; set; }
        /// <summary>
        /// 市场价
        /// </summary>
        public decimal market_price { get; set; }
       /// <summary>
       /// 销量
       /// </summary>
        public int sale_count{ get; set; }
        /// <summary>
        /// 主图
        /// </summary>
        public string main_image_url { get; set;}
        /// <summary>
        /// 创建时间
        /// </summary>
        public long create_time { get; set; }
        /// <summary>
        /// 分佣金额
        /// </summary>
        public decimal distribution_price { get; set; }
        /// <summary>
        /// 成本价
        /// </summary>
        public decimal cost_price { get; set; }
        /// <summary>
        /// 是否分销
        /// </summary>
        public int is_share { get; set; }
        /// <summary>
        /// 分销比例
        /// </summary>
        public string path { get; set; }
        /// <summary>
        /// 产品活动扩展
        /// </summary>
        public product_dto_activity_ex activity_ex { get; set; }
    }
	/// <summary>
	/// 商品规格
	/// </summary>
	[Serializable]
	public class product_sku_dto {
		/// <summary>
		/// 商品SKU的id
		/// </summary>
		public long id { get; set; }
		/// <summary>
		/// 商品id
		/// </summary>
		public long product_id { get; set; }
		/// <summary>
		/// 规格路径
		/// </summary>
		public string sku_path { get; set; }
		/// <summary>
		/// 规格名称
		/// </summary>
		public string sku_name { get; set; }
		/// <summary>
		/// 库存
		/// </summary>
		public int stock { get; set; }
		/// <summary>
		/// 价格
		/// </summary>
		public decimal price { get; set; }
        /// <summary>
        /// 成本价 结算价
        /// </summary>
        public decimal cost_price { get; set; }
        /// <summary>
        /// 分销价格
        /// </summary>
        public decimal distribution_price { get; set; }
        /// <summary>
        /// 最高购买数量（0表示不限制）
        /// </summary>
        public int max_quantity { get; set; }
        /// <summary>
        /// 产品活动扩展
        /// </summary>
        public product_dto_activity_ex activity_ex { get; set; }
        /// 开始时间
        /// </summary>
        public string start_Exp_Date { get; set; }
        /// <summary>
        /// 结束时间
        /// </summary>
        public string end_Exp_Date { get; set; }
    }
    /// <summary>
    /// 后台修改sku信息
    /// </summary>
    [Serializable]
    public class product_sku_info {
        /// <summary>
        /// 商品sku
        /// </summary>
        public string sku { get; set; }
        /// <summary>
        /// 保质期开始时间
        /// </summary>
        public string start_time { get; set; }
        /// <summary>
        /// 保质期结束时间
        /// </summary>
        public string end_time { get; set; }
        /// <summary>
        /// 成本价
        /// </summary>
        public decimal cost_price { get; set; }
        /// <summary>
        /// 规格
        /// </summary>
        public List<product_sku_dto> skus { get; set; }
    }

	/// <summary>
	/// 商品新增、编辑 请求参数
	/// </summary>
	[Serializable]
	public class product_model : head_req {
		public product_model() {
			image_path = new List<string>();
			props = new List<props_cls>();
			product_skus = new List<product_sku_dto>();
		}
		/// <summary>
		/// 产品id
		/// </summary>
		public long id { get; set; }
		/// <summary>
		/// 申报商品id
		/// </summary>
		public long good_dec_id { get; set; }
		/// <summary>
		/// 名称
		/// </summary>
		public string name { get; set; }
		/// <summary>
		/// 条码
		/// </summary>
		public string code { get; set; }
        /// <summary>
        /// 类型：1：实物 2：虚拟，3：积分，4：普惠积分，5：398升级创客商品
        /// </summary>
        public int type { get; set; }
		/// <summary>
		/// 排序
		/// </summary>
		public int top { get; set; }
		/// <summary>
		/// 分类id
		/// </summary>
		public long? category_id { get; set; }
		/// <summary>
		/// 市场价格
		/// </summary>
		public decimal market_price { get; set; }
		/// <summary>
		/// 价格
		/// </summary>
		public decimal price { get; set; }
        /// <summary>
        /// 成本价
        /// </summary>
        public decimal? cost_price { get; set; }
		/// <summary>
		/// 赠送积分
		/// </summary>
		public int points { get; set; }
		/// <summary>
		/// 是否开启三级分销
		/// </summary>
		public bool is_open { get; set; }
		/// <summary>
		/// 库存
		/// </summary>
		public int stock { get; set; }
		/// <summary>
		/// 销售量
		/// </summary>
		public int sale_count { get; set; }
		/// <summary>
		/// 兑换积分
		/// </summary>
		public int integral { get; set; }
		/// <summary>
		/// 运费
		/// </summary>
		public decimal freight { get; set; }
		/// <summary>
		/// 图片JSON:["",""]
		/// </summary>
		public List<string> image_path { get; set; }
		/// <summary>
		/// 内容
		/// </summary>
		public string description { get; set; }
		/// <summary>
		/// 销售状态:0原始状态,1出售中,2仓库中,3已删除
		/// </summary>
		public SaleStatus sale_status { get; set; }
		/// <summary>
		/// 备注说明
		/// </summary>
		public string short_description { get; set; }
		/// <summary>
		/// 商品标签 better：精选，hot：爆款
		/// </summary>
		public string tag { get; set; }
		/// <summary>
		/// 国家区域
		/// </summary>
		public string country { get; set; }
		/// <summary>
		/// 是否境外商品
		/// </summary>
		public bool is_seas { get; set; }
		/// <summary>
		/// 净重
		/// </summary>
		public double weight { get; set; }
		/// <summary>
		/// 净重单位
		/// </summary>
		public string weight_unit { get; set; }
		/// <summary>
		///  税点
		/// </summary>
		public decimal? tax { get; set; }
		/// <summary>
		/// 计量单位编码
		/// </summary>
		public string unit { get; set; }
        /// <summary>
        /// 分销等级
        /// </summary>
        public int? depth { get; set; }
        /// <summary>
        /// 分销比例
        /// </summary>
        public string path { get; set; }
        /// <summary>
        /// 价格分销比例
        /// </summary>
        public decimal? distribution_price { get; set; }
        /// <summary>
        /// 是否包税
        /// </summary>
        public bool is_tax { get; set; }
        /// <summary>
        /// 是否包运费
        /// </summary>
        public bool is_freight { get; set; }
        /// <summary>
        /// 产品属性
        /// </summary>
        public List<props_cls> props { get; set; }
        /// <summary>
        /// 商品主图
        /// </summary>
        public string main_image_url { get; set; }
        /// <summary>
        /// 商品规格
        /// </summary>
        public List<product_sku_dto> product_skus { get; set; }
        /// <summary>
        /// 海淘乐商品唯一编码
        /// </summary>
        public string sku { get; set; }
        /// <summary>
        /// 是否海淘乐商品
        /// </summary>
        public int is_htl { get; set; }
        /// <summary>
        /// 操作状态
        /// 1 – 添加，表示没有推送过该商品
        /// 2 – 修改，表示之前已经推送过该商品，但海淘乐系统有更新信息
        /// </summary>
        public int request_status { get; set; }
    }

	/// <summary>
	/// 产品审核
	/// </summary>
	[Serializable]
	public class product_audit_model {
		public long id { get; set; }
		/// <summary>
		/// 审核状态:1待审核,2销售中,3违规下架
		/// </summary>
		public AuditStatus audit_status { get; set; }
		/// <summary>
		/// 审核原因
		/// </summary>
		public string audit_reason { get; set; }
	}
	/// <summary>
	/// 商品审核、违规下架
	/// </summary>
	[Serializable]
	public class product_audit_req : head_req {
		/// <summary>
		/// 商品id
		/// </summary>
		public long id { get; set; }
		/// <summary>
		/// 审核状态:1待审核,2销售中,3违规下架
		/// </summary>
		public AuditStatus audit_status { get; set; }
		/// <summary>
		/// 审核原因
		/// </summary>
		public string audit_reason { get; set; }
	}

	/// <summary>
	/// 购物车数据
	/// </summary>
	[Serializable]
	public class cart_req_model : head_req {
		/// <summary>
		/// 购物车商品
		/// </summary>
		public List<cart_item> items;
	}
	/// <summary>
	/// 购物车商品项
	/// </summary>
	[Serializable]
	public class cart_item {
		/// <summary>
		/// 商品id
		/// </summary>
		public long product_id { get; set; }
		/// <summary>
		/// 商品名称
		/// </summary>
		public string product_name { get; set; }
		/// <summary>
		/// 规格
		/// </summary>
		public string sku_path { get; set; }
		/// <summary>
		/// 数量
		/// </summary>
		public int quantity { get; set; }
		/// <summary>
		/// 价格
		/// </summary>
		public decimal unit_price { get; set; }
	}

	/// <summary>
	/// 购买的商品返回要更新的字段
	/// </summary>
	[Serializable]
	public class product_freight {
		/// <summary>
		/// 卖家编号
		/// </summary>
		public string merchant_no { get; set; }
		/// <summary>
		/// 商品id
		/// </summary>
		public long product_id { get; set; }
		/// <summary>
		/// 抵扣积分
		/// </summary>
		public int integral { get; set; }
		/// <summary>
		/// 运费
		/// </summary>
		public decimal freight { get; set; }
        /// <summary>
        /// 商品类型 1：实物 2：虚拟，3：积分，4：普惠积分，5：398升级创客商品
        /// </summary>
        public int type { get; set; }
		/// <summary>
		/// 商品名称
		/// </summary>
		public string product_name { get; set; }
		/// <summary>
		/// 规格
		/// </summary>
		public string sku_path { get; set; }
		/// <summary>
		/// 规格名称
		/// </summary>
		public string sku_name { get; set; }
		/// <summary>
		/// 价格
		/// </summary>
		public decimal unit_price { get; set; }
		/// <summary>
		/// 市场价
		/// </summary>
		public decimal market_price { get; set; }
		/// <summary>
		/// 成本价
		/// </summary>
		public decimal cost_price { get; set; }
		/// <summary>
		/// 商品缩略图
		/// </summary>
		public string thumbnails_url { get; set; }
		/// <summary>
		/// 是否可以买
		/// </summary>
		public bool is_buy { get; set; }
		/// <summary>
		/// 不能购买的原因
		/// </summary>
		public string fail { get; set; }
		/// <summary>
		/// 赠送积分
		/// </summary>
		public int points { get; set; }
		/// <summary>
		/// 是否开启三级分销
		/// </summary>
		public bool is_open { get; set; }
		/// <summary>
		/// 是否境外商品
		/// </summary>
		public bool is_seas { get; set; }
		/// <summary>
		/// 商品净重
		/// </summary>
		public double weight { get; set; }
		/// <summary>
		/// 税点
		/// </summary>
		public decimal? tax { get; set; }
		/// <summary>
		/// 店铺名称
		/// </summary>
		public string shop_name { get; set; }
		/// <summary>
		/// 集散地名称
		/// </summary>
		public string entrepot_name { get; set; }
		/// <summary>
		/// 分销等级
		/// </summary>
		public int depth { get; set; }
		/// <summary>
		/// 分销比例路径 如0.7_0.2_0.1
		/// </summary>
		public string path { get; set; }
		/// <summary>
		/// 分销比例
		/// </summary>
		public decimal distribution_price { get; set; }
		/// <summary>
		/// 是否包税
		/// </summary>
		public bool is_tax { get; set; }
		/// <summary>
		/// 是否包邮
		/// </summary>
		public bool is_freight { get; set; }
	}

    public class product_calculate_ex {
        /// <summary>
        /// 商家用户
        /// </summary>
        public long merchant_id { get; set; }
        /// <summary>
        /// 销售价
        /// </summary>
        public decimal price { get;set;}
        /// <summary>
        /// 活动价格红钻部分
        /// </summary>
        public decimal activity_red_drill { get; set; }
        /// <summary>
        /// 成本价
        /// </summary>
        public decimal cost_price { get; set; }
        /// <summary>
        /// 分销价
        /// </summary>
        public decimal distribution_price { get; set; }
        /// <summary>
        /// 库存
        /// </summary>
        public int stock { get; set; }
        /// <summary>
        /// 运费
        /// </summary>
        public decimal freight { get; set; }
        /// <summary>
        /// 活动是否售罄
        /// </summary>
        public bool is_sold_out { get; set; }
        /// <summary>
        /// 是否在售
        /// </summary>
        public bool is_sale { get; set; }
        /// <summary>
        /// 活动类型（0：无，1：398创客活动，2：限时购活动，3：红钻+现金，4：红钻兑换）
        /// </summary>
        public int activity_type { get; set; }
        /// <summary>
        /// 产品来源（0：其他，1：海淘乐，2：候鸟）
        /// </summary>
        public int product_source { get; set; }
        /// <summary>
        /// 商品活动Id
        /// </summary>
        public long? product_activity_id { get; set; }
        /// <summary>
        /// 最高购买数量（0表示不限制）
        /// </summary>
        public int max_quantity { get; set; }
        /// <summary>
        /// 活动开始时间
        /// </summary>
        public DateTime? begin_time { get; set; }
        /// <summary>
        /// 开始预热时间
        /// </summary>
        public DateTime? preheat_time { get; set; }

    }
}